PrCtlCall
PrCtlCall
Execute a printer driver control routine void PrCtlCall(fnCode, parm1, parm2, parm3 ); short fnCode ; identifies operation to perform
long parm1 ; 32-bit parameters ...
long parm2 ; ... whose usage varies ...
long parm3 ; ... depending upon fnCode
PrCtlCall provides low-level access to the printer driver device control entry. Use this function for sending a bit map to the printer, using a Sony
printer to print a whole screen or just the top window, streaming text to the
printer, or resetting the printer, forcing line feeds, and ejecting a page.
fnCode identifies which function you wish to perform. It is one of the
following codes, defined in PrintMgr.h:
iPrBitsCtl 4 Bit map printing
iPrIOCtl 5 Text streaming
iPrEvtCtl 6 For printing the whole screen or just the top window
iPrDevCtl 7 Printer control (linefeeds, formfeeds, etc.)
parm1 ...
parm2 ... and ...
parm3 are parameters whose values and meanings vary, depending upon
the value of fnCode. See Notes, below.
Notes: Most applications will not need to use this low-level PrCtlCall function and we are warned to NOT mix low-level calls with the higher-level calls.
call, in which csCode =fnCode and csParm is the address of a 12-byte
array of three longs; parm1 would be stored at csParm [0], parm2 at
csParm [1], etc.
Printing Bit Maps
Use fnCode = iPrBitsCtl for dumping a bit map to the printer. The format of the call is:
void PrCtlCall( fnCode, pBitMap, pPortRect, optionFlag ); short fnCode ; iPrBitsCtl (4)
Rect *pPortRect ; defines dimensions to print long optionFlag ; 0=normal; 1=tall adjusted
fnCode is iPrBitsCtl (4) to specify dumping a bit map.
pBitMap is the address of a 14-byte BitMap identifying the size and memory location of the bits to print.
pPortRect is the address of an 8-byte Rect specifying a subset of the bit map to dump. It is expressed in the coordinate system of the bit map to be
printed.
optionFlag lets you choose between using a default dot size or square dots (for
visual fidelity). It is one of the following 32-bit constants, defined
in PrintMgr.h:
lScreenBits 0x00010000 printer default dot size
lPaintBits 0x00010001 square dots (72 X 72) (use for
LaserWriter)
lHiScreenBits 0x00010002 High density default dots
lHiPaintBits 0x00010003 High density square dots
For example, to dump the entire screen to the printer, using fastest (not
tall-adjusted) output:
PrCtlCall( iPrBitsCtl, & screenBits, & screenBits.bounds, lScreenBits ); To dump a single window, using the slower (square-dot) output:
PrCtlCall( iPrBitsCtl, &win->portBits, &win->portRect, lPaintBits); Window Printing
Use fnCode = iPrEvtCtl for Sony printers to print either the whole screen or just the top window, depending on the parameter selected. The format of
the call is:
short fnCode ; iPrEvtCtl (6)
long actionCode ; (see below)
long parm2 ; these two parameters ...
long parm3 ; ... are always 0
fnCode is iPrEvtCtl (6) to specify a printer control action.
actionCode specifies which action to take. It is one of the following 32-bit
constants, defined in PrintMgr.h:
lPrEvtAll 0x0002FFFD Print the whole screen
lPrEvtTop 0x0003FFFD Just print the top window
parm2 and...
parm3 must be zero when fnCode = iPrEvtCtl.
Direct Printer Control
Use fnCode = iPrDevCtl for hardware-independent printer control. This is most-often used in conjunction with text streaming. For instance, rather
than streaming a CR (ASCII 0x0D) as described below, you should send a
device control code. The format of the call is:
short fnCode ; iPrDevCtl (7)
long actionCode ; (see below)
long parm2 ; these two parameters ...
long parm3 ; ... are always 0
fnCode is iPrDevCtl (7) to specify a printer control action.
actionCode specifies which action to take. It is one of the following 32-bit
constants, defined in PrintMgr.h:
lPrReset 0x00010000 Reset the printer(a.k.a
lPrDocOpen)
0x0001nnnn (low byte sets number of copies)
lPrLineFeed 0x00030000 Send a carriage return (no
linefeed)
0x0003nnnn (low byte is number of dots to feed)
lPrLFSixth 0x0003FFFF Feed 1/6-th of an inch
lPrLFEighth 0x0003FFFE Feed 1/8-th of an inch
lPrPageEnd 0x00020000 End of page (force page eject)(a.k.a
lPrPageClose )
lPrPageOpen 0x00040000 Start a new page
lPrDocClose 0x00050000 Finish printing
parm2 and...
parm3 must be zero when fnCode = iPrDevCtl.
For example, to send a 1/6-th inch linefeed to the printer, use:
To force an 8-dot linefeed and carriage return, use:
Use fnCode = iPrIOCtl to send bytes directly to the printer. This lets you use printer-dependent escape sequences to control the printer output. The
format of the call is:
void PrCtlCall( fnCode, pBuffer, lBufLen, 0 ); short fnCode ; iPrIOCtl (5)
Ptr pBuffer ; address of text to send to the printer long lBufLen ; count of bytes to send to the printer
long parm3 ; always 0
fnCode is iPrDevCtl (5) to specify text streaming.
pBuffer is the address of a buffer containing the data to stream to the
printer..
lBufLen specifies how may bytes to send to the printer.
parm3 must be zero when fnCode = iPrIOCtl.
For example, to send a string to the printer, use:
PrCtlCall( iPrIOCtl, "Hi there", 8,0 ); /* send text */ PrCtlCall( iPrDevCtl, lPrLFSixth, 0,0 ); /* force CR LF */